<?php

namespace MessageMap\Rabbit;

use MessageMap\MsgCenter\MessageMap;

class MsgMap
{
    /**
     *  注册消息
     */
    const TYPE_REGISTER = 1;

    /**
     *  购买成功消息
     */
    const TYPE_ORDER_SUCCESS = 2;

    /**
     * 通知消息
     */
    const TYPE_MESSAGE = 4;
    /**
     * 登录
     */
    const TYPE_LOGIN = 6;

    /**
     * 退款
     */
    const TYPE_REFUND = 9;

    /**
     * 绑定公众号消息
     */
    const TYPE_USER_WX_BIND = 11;

    /**
     * 关注公众号消息
     */
    const TYPE_USER_WX_SUBSCRIBE = 12;

    /**
     * 取消公众号消息
     */
    const TYPE_USER_WX_UNSUBSCRIBE = 13;

    /**
     * 拼团成团消息
     */
    const TYPE_GROUP_SPELL_ORDER_SUCCESS = 26;

    const TYPE_ORDER_CREATE = 40; // 订单创建
    const TYPE_ORDER_CANCEL = 41; // 订单取消

    //Exchange
    const EXCHANGE_REGISTER = 'register';
    const EXCHANGE_MESSAGE = 'message';
    const EXCHANGE_ORDER = 'order';
    const EXCHANGE_LOGIN = 'login';
    const EXCHANGE_REFUND = 'refund';
    const EXCHANGE_USER_WX_BIND = 'wx_bind';
    const EXCHANGE_USER_WX_SUBSCRIBE = 'wx_subscribe';
    const EXCHANGE_USER_WX_UNSUBSCRIBE = 'wx_unsubscribe';


    /**
     * 消息体data扩展结构
     */
    const MSG_DATA_STRUCTURE = [
        self::TYPE_LOGIN => [
            'time' => '登录时间',
            'distinctID' => '神策唯一标识',
        ],
        self::TYPE_REGISTER => [
            'channel' => '注册渠道',
            'mobile' => '注册手机',
            'refer_user_id' => '邀请者',
            'distinctID' => '神策唯一标识',
        ],
        self::TYPE_ORDER_SUCCESS => [
            'order_id' => '订单ID',
            'price' => '价格',
            'money' => '实付金额',
        ],
        self::TYPE_ORDER_CREATE => [
            'order_id' => '订单ID',
            'card_id' => '课次卡',
            'price' => '价格',
        ],
        self::TYPE_ORDER_CANCEL => [
            'order_id' => '订单ID',
            'card_id' => '课次卡',
        ],
        self::TYPE_REFUND => [
            'card_order_id' => '订单ID',
        ],
        self::TYPE_MESSAGE => [
            'message_type' => '通知消息类型',
            'data' => [
                MessageMap::TYPE_SMS => [
                    //短信类型时
                    'type' => '短信类型',
                    'phone' => '手机号',
                    'platform' => '短信平台',
                    'sign' => '短信签名string，腾讯云传sign_id',
                    'ext' => [
                        'tpl_id' => '腾讯云平台模板id',
                        'params' => '腾讯云平台参数数组',
                        'content' => '其它平台短信内容',
                    ],
                ],
                MessageMap::TYPE_WX_TEMPLATE => [
                    //微信类型
                    'tpl_id' => '模板id',
                    'jump_url' => '跳转地址',
                    'mini_url' => '小程序',
                    'content' => '模板匹配数据'
                ],
                MessageMap::TYPE_WX_MINI_PROGRAM => [
                    //微信类型
                    'appId' => '小程序APP_ID',
                    'openId' => '小程序openId',
                    'tplId' => '小程序模板消息模板',
                    'page' => '小程序页面',
                    'formId' => '表单id',
                    'data' => '小程序内容',
                    'emphasisKeyword' => '需要放大的关键字',
                ],
                MessageMap::TYPE_PUSH => [
                    //push类型
                ]
            ],
            'web_open_id' => '',
        ],
        self::TYPE_USER_WX_BIND => [
            [
                'user_id' => '用户ID',
            ],
        ],
    ];
}